#pragma once

#define DIRECTINPUT_VERSION 0x0800

// Linking
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")

// Includes
#include <dinput.h>
#include <vector>
#include <string>
using namespace std;

// macro for checking key in keyboard buffer
#define KEYDOWN(name, key) (name[key] & 0x80)

/// <Summary>
/// Class name: InputClass
/// </Summary>
class InputClass
{
public:
	InputClass();
	InputClass(const InputClass& rhs);
	~InputClass();

	bool Initialize(HINSTANCE, HWND, int, int);
	void Shutdown();
	bool Frame();

	bool IsEscapePressed();
	void IsKeyPressed(vector<char>& vec, string& command);

	void GetMouseLocation(int&, int&);

private:
	bool ReadKeyboard();
	bool ReadMouse();
	void ProcessInput();

private:
	IDirectInput8*			m_directInput;
	IDirectInputDevice8*	m_keyboard;
	IDirectInputDevice8*	m_mouse;

	unsigned char			m_keyState[256];
	unsigned char			m_previousKeyState[256];
	DIMOUSESTATE			m_mouseState;

	int						m_screenWidth, m_screenHeight;
	int						m_mouseX, m_mouseY;
};